﻿@{
    Layout = "~/Areas/Admin/Views/Shared/_LayoutCMS.cshtml";
    ViewBag.Title = "AssetEdit";
}
@model LY.Entity.T_AssetManagement
<h2></h2>

<script src="~/Content/assets/layer/layer.min.js"></script>
<link href="~/Content/assets/css/Layout/css/main.css" rel="stylesheet" />
<link href="~/Content/assets/css/plugin/validator.css" rel="stylesheet" />
<script src="~/Content/assets/js/jquery.uploadify.v2.1.4.js"></script>
<link href="~/Content/assets/css/plugin/xjgrid.css" rel="stylesheet" />
<script src="~/Content/editor/kindeditor-min.js"></script>
<script src="~/Content/editor/lang/zh_CN.js"></script>
<div class="container">

    <div id="forms" class="mt10" aria-disabled="False">
        <div class="box">
            <div class="box_border">
                <div class="box_top"><b class="pl15">编辑资产信息</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;带“ <span style="color: red">*</span> ”标识为必填项</div>
                <div class="box_center">
                    <form  id="frmEdit" method="post" action="@Url.Action("AssetSave")" role="form" class="jqtransform">
                        <input id="hideId" name="ID" value="@Model.ID" type="hidden" />
                        <table class="form_table pt15 pb15" style="width: 100%;" border="0">
                            <tr>
                                <td class="td_right"><b style="color: red;">*</b> 资管名称：</td>
                                <td class="">
                                    <input type="text" id="AssetName" name="AssetName" value="@Model.AssetName" class="input-text lh30" size="40">
                                </td>
                                <td class="td_right"><b style="color: red;">*</b> 资产管理人：</td>
                                <td class="">
                                    <input type="text" id="Assetmanagers" name="Assetmanagers" value="@Model.Assetmanagers" class="input-text lh30" size="40">
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right"><b style="color: red;">*</b> 资产托管人：</td>
                                <td class="">
                                    <input type="text" id="Assetcustodians" name="Assetcustodians" value="@Model.Assetcustodians" class="input-text lh30" size="40">
                                </td>
                                <td class="td_right"><b style="color: red;">*</b> 起购金额：</td>
                                <td class="">
                                    <input type="text" id="Minamount" name="Minamount" maxlength="13" onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onafterpaste="this.value=this.value.replace(/[^\d]/g,'')" value="@Model.Minamount" class="input-text lh30" size="40"><b style="color: red;">万元</b>
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">资管类型：</td>
                                <td class="">
                                    <input type="text" id="Assettype" name="Assettype" value="@Model.Assettype" class="input-text lh30" size="40">
                                </td>
                                <td class="td_right"><b style="color: red;">*</b> 户名：</td>
                                <td class="">
                                    <input type="text" id="AccountName" name="AccountName" value="@Model.AccountName" @*onkeyup="this.value=this.value.replace(/[^\u4E00-\u9FA5]/g,'')" onafterpaste="this.value=this.value.replace(/[^\u4E00-\u9FA5]/g,'')"*@  class="input-text lh30" size="40">
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right"><b style="color: red;">*</b> 账号：</td>
                                <td class="">
                                    <input type="text" id="AccountNumber" name="AccountNumber"@* onblur="ValidateAccount(this.id,this.value)"*@ onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"   value="@Model.AccountNumber" maxlength="20" class="input-text lh30" size="40">
                                </td>
                                <td class="td_right">开户行：</td>
                                <td class="">
                                    <input type="text" id="Bank" name="Bank" class="input-text lh30" value="@Model.Bank" size="40" />
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right"><b style="color: red;">*</b> 期限：</td>
                                <td class="">
                                    <input type="text" id="Deadline" name="Deadline"  value="@Model.Deadline" maxlength="2"  onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onafterpaste="this.value=this.value.replace(/[^\d]/g,'')"  class="input-text lh30" size="40"><span style="color: red;">个月</span>
                                </td>
                                <td class="td_right">图片：</td>
                                <td class="">
                                    <input type="hidden" id="hidAssetImg" name="AssetImg" value="@Model.AssetImg" />
                                    <img src="@Model.AssetImg" id="showimg" height="100" width="80"/>
                                    <input type="button" id="btnUploadImg" value=" 上传资源 " />
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">备注：</td>
                                <td class="" colspan="3">
                                    <input type="hidden" id="hideRemark" name="Remark" value="@Model.Remark">
                                    <textarea id="Remark" rows="10" style="height: 260px; width: 90%">@Model.Remark</textarea>
                                </td>
                            </tr>
                            <tr>
                                <td class="td_center" colspan="5">
                                    <input type="button" id="btnSave" name="button" style="margin-right: 50px;" class="btn btn82 btn_save2" value="保存">
                                    <input type="button" id="btnReturn" name="button" class="btn btn82 btn_res" value="返回">
                                </td>
                            </tr>
                        </table>
                        <input type="hidden" id="hideContent" name="Peopleremark" />
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@section jssection{
    <script type="text/javascript">
        //编辑器
        KindEditor.ready(function (K) {
            window.editor = K.create('textarea', {
                resizeType: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: true,
                minWidth: 350,
                allowFileManager: true,
                afterBlur: function () {
                    this.sync();
                }

            });
        });

        var util = {};
        var options = {
            editUrl: "@Url.Action("FundPeopleSave")",
            uploadUrl: "@Url.Action("UploadImg", "Helper")"
        };
        


        $(document).ready(function () {
            //初始化图片上传  
            var btnImg = document.getElementById("btnUploadImg");
            g_AjxUploadImg(btnImg);

        });
        var g_AjxTempDir = "/FileUpload/";
        //图片上传  
        function g_AjxUploadImg(btn) {
            var button = btn, interval;
            new AjaxUpload(button, {
                action: options.uploadUrl,
                data: {},
                name: 'myfile',
                onSubmit: function (file, ext) {
                    if (!(ext && /^(jpg|JPG|png|PNG|gif|GIF)$/.test(ext))) {
                        alert("您上传的图片格式不对，请重新选择！");
                        return false;
                    }
                },
                onComplete: function (file, response) {
                    flagValue = response;
                    if (flagValue == "-1") {
                        alert("您上传的图片格式不对，请重新选择！");
                    }
                    else if (flagValue == "-2") {
                        alert("您上传的图片大于2兆，请重新选择！");
                    }
                    else if (flagValue == "-3") {
                        alert("图片上传失败！");
                    }
                    else {

                        var strs = new Array();
                        strs = response.split("/");

                        var oldname = strs[0];
                        var newname = strs[1];
                        var filepath = strs[2];


                        var src = g_AjxTempDir + filepath + "/" + newname;
                        $("#hidAssetImg").val(src);
                        $("#showimg").attr("src", src);
                        //var newimg = [];
                        //newimg.push('<div><div class="cp_img" id="2679">');
                        //newimg.push('<img class="imgShow" src=' + src + ' alt="" height="100" width="100" />');
                        //newimg.push('</div>');
                        //$(newimg.join('')).appendTo('#div_img');
                    }
                }
            });
        }
    </script>
    <script type="text/javascript">
        function ValidateAccount(id, value) {
            if (isNaN(value)) {
                alert("账号不能为非数字！");
                $("#" + id).val("");
                return false;
            }
            else if (value == "") {
                alert("账号为必填！");
                return false;
            }
            else if (!(value.length >= 16 && value.length <= 19)) {
                alert("账号格式不正确！账号为16-19位字符的数字！");
                $("#" + id).focus();
                return false;
            }
        }
        function ValidateAccountName(id, value) {
            var patrn = /^\s*[\u4e00-\u9fa5]{1,}[\u4e00-\u9fa5.·]{0,15}[\u4e00-\u9fa5]{1,}\s*$/;
            if (!patrn.exec(value)) {
                alert("户名为2-15字的中文");
                $("#" + id).val("");
                $("#" + id).focus();
                return false;
            }
            return true;
        }
    </script>
    <script src="~/Content/assets/layer/layer.min.js"></script>
    <script src="~/Content/assets/plugins/validator/validator.js"></script>
    <script src="~/Content/assets/js/common.js"></script>
    <script src="~/Content/assets/DatePicker/WdatePicker.js"></script>
    <script src="~/Content/assets/app/common/ajaxupload.js"></script>
    <script src="~/Content/assets/app/asset/assetedit.js"></script>
}

<script type="text/javascript">
    var u = UE.getEditor('Remark');
</script>
